﻿using AssemblyVerifier;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;

namespace AssemblyVerifier.Tests
{
	[TestClass]
	public sealed class VerificationExceptionTests
	{
		[TestMethod]
		public void CreateExceptionWithVerificationErrors()
		{
			var errors = new List<VerificationError>();
			errors.Add(VerificationError.Create(
				@"[IL]: Error: [C:\Proxy.dll : AType::HookByRefValueTypeProxy][offset 0x00000025][found Int32] Expected an ObjRef on the stack."));
			var exception = new VerificationException(errors.AsReadOnly());
			Assert.AreEqual(1, exception.Errors.Count);
		}

		[TestMethod]
		[ExpectedException(typeof(ArgumentNullException))]
		public void CreateExceptionWithNullCollection()
		{
			new VerificationException(null as ReadOnlyCollection<VerificationError>);
		}
	}
}